<div [@routerTransition]>
    <div class="m-subheader">
        <div class="row align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title">
                    <span>成本明细</span>
                </h3>
            </div>
        </div>
    </div>
    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <form class="horizontal-form" autocomplete="off">
                    <div class="m-form m-form--label-align-right">
                        <div class="row align-items-center m--margin-bottom-10">
                            <div class="col-xl-12">
                                <div class="form-group m-form__group align-items-center">
                                    <div class="input-group">
                                        <input
                                            [(ngModel)]="filterText"
                                            name="filterText"
                                            autoFocus
                                            class="form-control m-input"
                                            [placeholder]="l('SearchWithThreeDot')"
                                            type="text"
                                        />
                                        <span class="input-group-btn">
                                            <button (click)="getCosts()" class="btn btn-primary" type="submit">
                                                <i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row m--margin-bottom-10" [hidden]="!advancedFiltersAreShown"></div>

                        <div class="row margin-bottom-10" *ngIf="advancedFiltersAreShown">
                            <div class="col-sm-12 text-right">
                                <button class="btn btn-metal" (click)="getCosts()">
                                    <i class="fa fa-sync"></i> {{ "Refresh" | localize }}
                                </button>
                            </div>
                        </div>
                        <div class="row margin-bottom-10">
                            <div class="col-sm-12">
                                <span
                                    class="clickable-item text-muted"
                                    *ngIf="!advancedFiltersAreShown"
                                    (click)="advancedFiltersAreShown = !advancedFiltersAreShown"
                                    ><i class="fa fa-angle-down"></i> {{ "ShowAdvancedFilters" | localize }}</span
                                >
                                <span
                                    class="clickable-item text-muted"
                                    *ngIf="advancedFiltersAreShown"
                                    (click)="advancedFiltersAreShown = !advancedFiltersAreShown"
                                    ><i class="fa fa-angle-up"></i> {{ "HideAdvancedFilters" | localize }}</span
                                >
                            </div>
                        </div>
                    </div>
                </form>

                <div class="row align-items-center">
                    <!--<Primeng-TurboTable-Start>-->
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                        <p-table
                            #dataTable
                            (onLazyLoad)="getCosts($event)"
                            [value]="primengTableHelper.records"
                            rows="{{ primengTableHelper.defaultRecordsCountPerPage }}"
                            [paginator]="false"
                            [lazy]="true"
                            [responsive]="primengTableHelper.isResponsive"
                        >
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width:160px">
                                        条码
                                    </th>
                                    <th style="width:80px">
                                        车间
                                    </th>
                                    <th style="width:60px">
                                        工序号
                                    </th>
                                    <th style="width:100px">
                                        工序名称
                                    </th>
                                    <th style="width:80px">
                                        类型
                                    </th>
                                    <th style="width:80px">
                                        项目
                                    </th>
                                    <th style="width:80px">
                                        时间
                                    </th>
                                    <th style="width:80px">
                                        成本
                                    </th>
                                    <th style="width:160px">
                                        公式
                                    </th>

                                    <th style="width:100px">
                                        备注
                                    </th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit">
                                <tr>
                                    <td>
                                        {{ record.batchId }}
                                    </td>
                                    <td>
                                        {{ record.workshop }}
                                    </td>
                                    <td>
                                        {{ record.processSequence }}
                                    </td>
                                    <td>
                                        {{ record.processName }}
                                    </td>
                                    <td>
                                        {{ record.category }}
                                    </td>
                                    <td>
                                        {{ record.type }}
                                    </td>
                                    <td>
                                        {{ record.time | momentFormat: "YYYY-MM-DD HH:mm" }}
                                    </td>
                                    <td>
                                        {{ record.amount | number: "1.2-2" }}
                                    </td>
                                    <td>
                                        {{ record.formula }}
                                    </td>
                                    <td>
                                        {{ record.remark }}
                                    </td>
                                </tr>
                            </ng-template>
                        </p-table>
                        <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                            {{ "NoData" | localize }}
                        </div>
                        <div class="primeng-paging-container">
                            <p-paginator
                                [rows]="primengTableHelper.defaultRecordsCountPerPage"
                                #paginator
                                (onPageChange)="getCosts($event)"
                                [totalRecords]="primengTableHelper.totalRecordsCount"
                                [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage"
                            >
                            </p-paginator>
                            <span class="total-records-count">
                                {{ "TotalRecordsCount" | localize: primengTableHelper.totalRecordsCount }}
                            </span>
                        </div>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>
            </div>
        </div>
    </div>
</div>
